class_name MultiwayStateTransition
extends StateTransition

##
var dimensions: Array[Callable]

##
var state_map: Dictionary


func _init(
	init_name: String,
	init_dimensions: Array[Callable],
	init_state_map: Dictionary
) -> void:
	super(init_name)
	dimensions = init_dimensions
	state_map = init_state_map


func _try_condition() -> bool:
	return true


func _try_transition() -> String:
	var coordinate: Array[int] = []
	
	for dimension: Callable in dimensions:
		coordinate.append(dimension.call())
		
	if not state_map.has(coordinate):
		Logger.fatal("State map does not have the coordinate '%s'." % coordinate)
		return ""

	return state_map[coordinate]


func _on_transit() -> void:
	pass
